{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">订单列表</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">

                <form class="layui-form layui-form-pane" action="{:url('admin/order/index')}" method="get">
                    <div class="layui-inline">
                        <label class="layui-form-label">关键字</label>
                        <div class="layui-input-inline">
                            <input type="text" name="keyword" value="{$keyword}" placeholder="请输入关键字" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn">搜索</button>
                    </div>
                </form>
                <hr>
                <form action="" method="post" class="ajax-form">

                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th style="width: 15px;"><input type="checkbox" class="check-all"></th>
                            <th style="width: 30px;">订单编号</th>
                            <th>收货人</th>
                            <th>总金额</th>
                            <th>应付金额</th>
                            <th>订单状态</th>
                            <th>支付状态</th>
                            <th>发货状态</th>
                            <!--<th>支付方式</th>-->
                            <th>下单时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="order_list" id="vo"}
                        <tr>
                            <td><input type="checkbox" name="ids[]" value="{$vo.id}"></td>
                            <td>{$vo.order_sn}</td>
                            <td>{$vo.user_name}</td>
                            <th>{$vo.total_amount}</th>
                            <th>{$vo.order_amount}</th>
                            <th>
                                {switch name="vo.order_status"}
                                {case value="1"}待发货{/case}
                                {case value="2"}待收货{/case}
                                {case value="3"}已完成{/case}
                                {default /}待付款
                                {/switch}
                            </th>
                            <th>
                                {switch name="vo.pay_status"}
                                {case value="1"}已支付{/case}
                                {case value="2"}部分支付{/case}
                                {case value="3"}已退款{/case}
                                {case value="4"}拒绝退款{/case}
                                {default /}未支付
                                {/switch}
                            </th>
                            <th>{switch name="vo.shipping_status"}
                                {case value="1"}已发货{/case}
                                {default /}未发货
                                {/switch}
                            </th>
                            <th>{$vo.create_time}</th>
                            <td>
                                <a href="{:url('admin/order/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                                <a href="{:url('admin/order/delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                    <button type="button" class="layui-btn layui-btn-danger layui-btn-small ajax-action" data-action="{:url('admin/order/delete')}">删除</button> 第{$order_list->currentPage()}页&nbsp;&nbsp;共{$order_list->total()}条
                </form>
                <div class="news_paginate">  {$order_list->render()}</div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}

<script type="text/javascript">

    function changeSortId(obj) {
        var sort_id = $(obj).val();
        var id = $(obj).attr("altid");
        $.ajax({
            type: "post",
            url: "/admin/order/changeSort",
            data: {
                ad_sort: sort_id,
                id: id,
            },
            dataType: 'json',
            success: function (data) {
                $(obj).val(data.ad_sort)
            }
        });
    }
    //监听指定开关
    form.on('switch(changeStatus)', function(data){
        changeStatus(data,1);
    });
</script>
{/block}
